Default Notebook Extensions for Better Presentations:

pwd
'C:\\Users\\Administrator\\Documents\\GitHub\\DSAIML\\00-Python\\00-notebooks'
from sklearn import datasets
import pandas as pd
wine_data = pd.DataFrame(datasets.load_wine().data)
wine_data.columns = datasets.load_wine().feature_names
wine_data.head(5)
| alcohol | malic_acid | ash | alcalinity_of_ash | magnesium | total_phenols | flavanoids | nonflavanoid_phenols | proanthocyanins | color_intensity | hue | od280/od315_of_diluted_wines | proline | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 14.23 | 1.71 | 2.43 | 15.6 | 127.0 | 2.80 | 3.06 | 0.28 | 2.29 | 5.64 | 1.04 | 3.92 | 1065.0 |
| 1 | 13.20 | 1.78 | 2.14 | 11.2 | 100.0 | 2.65 | 2.76 | 0.26 | 1.28 | 4.38 | 1.05 | 3.40 | 1050.0 |
| 2 | 13.16 | 2.36 | 2.67 | 18.6 | 101.0 | 2.80 | 3.24 | 0.30 | 2.81 | 5.68 | 1.03 | 3.17 | 1185.0 |
| 3 | 14.37 | 1.95 | 2.50 | 16.8 | 113.0 | 3.85 | 3.49 | 0.24 | 2.18 | 7.80 | 0.86 | 3.45 | 1480.0 |
| 4 | 13.24 | 2.59 | 2.87 | 21.0 | 118.0 | 2.80 | 2.69 | 0.39 | 1.82 | 4.32 | 1.04 | 2.93 | 735.0 |
markdown syntax: https://www.markdownguide.org/basic-syntax/
If File is available in the same current working directory folder
import pandas as pd
df1 = pd.read_csv(
'hcpuniverse.csv', sep=";"
) #goback to the previous parent directory files other than present working directory
df1.shape
(3681, 6)
(3681, 6)
If the File is available in the folder curresponding the same working directory location
import pandas as pd
df2 = pd.read_csv(
'01A-data/hcpuniverse.csv', sep=";"
) #goback to the previous parent directory files other than present working directory
df2.shape
(3681, 6)
(3681, 6)
OR
import pandas as pd
df3 = pd.read_csv(
'./01A-data/hcpuniverse.csv', sep=";"
) #goback to the previous parent directory files other than present working directory
df3.shape
(3681, 6)
(3681, 6)
import pandas as pd
df4 = pd.read_csv(
'../01-data/hcpuniverse.csv', sep=";"
) #goback to the previous parent directory files other than present working directory
df4.shape
(3681, 6)
(3681, 6)
df4.head()
| c_First_Name | h_First_Name | c_Last_Name | h_Last_Name | c_Title | h_Title | |
|---|---|---|---|---|---|---|
| 0 | Brian | BRIAN | Kelly | KELLY | Medicine | PHYSICAL MEDICINE AND REHABILITATION |
| 1 | Rahul | RAHUL | Sharma | SHARMA | Laboratory Director | PHYSICAL MEDICINE AND REHABILITATION |
| 2 | Kashif | KASHIF | Khan | KHAN | Anesthesia | GERIATRIC MEDICINE |
| 3 | Mark | MARK | Smith | SMITH | Anesthesia | INTERNAL MEDICINE |
| 4 | Paul | PAUL | Harris | HARRIS | Apprenticeship in Joinery | FAMILY PRACTICE |
| c_First_Name | h_First_Name | c_Last_Name | h_Last_Name | c_Title | h_Title | |
|---|---|---|---|---|---|---|
| 0 | Brian | BRIAN | Kelly | KELLY | Medicine | PHYSICAL MEDICINE AND REHABILITATION |
| 1 | Rahul | RAHUL | Sharma | SHARMA | Laboratory Director | PHYSICAL MEDICINE AND REHABILITATION |
| 2 | Kashif | KASHIF | Khan | KHAN | Anesthesia | GERIATRIC MEDICINE |
| 3 | Mark | MARK | Smith | SMITH | Anesthesia | INTERNAL MEDICINE |
| 4 | Paul | PAUL | Harris | HARRIS | Apprenticeship in Joinery | FAMILY PRACTICE |
import pandas as pd
df5 = pd.read_csv('../../00-Python/hcpuniverse.csv',sep=";") #goback to the previous/parent directory files
df5.head()
| c_First_Name | h_First_Name | c_Last_Name | h_Last_Name | c_Title | h_Title | |
|---|---|---|---|---|---|---|
| 0 | Brian | BRIAN | Kelly | KELLY | Medicine | PHYSICAL MEDICINE AND REHABILITATION |
| 1 | Rahul | RAHUL | Sharma | SHARMA | Laboratory Director | PHYSICAL MEDICINE AND REHABILITATION |
| 2 | Kashif | KASHIF | Khan | KHAN | Anesthesia | GERIATRIC MEDICINE |
| 3 | Mark | MARK | Smith | SMITH | Anesthesia | INTERNAL MEDICINE |
| 4 | Paul | PAUL | Harris | HARRIS | Apprenticeship in Joinery | FAMILY PRACTICE |
| c_First_Name | h_First_Name | c_Last_Name | h_Last_Name | c_Title | h_Title | |
|---|---|---|---|---|---|---|
| 0 | Brian | BRIAN | Kelly | KELLY | Medicine | PHYSICAL MEDICINE AND REHABILITATION |
| 1 | Rahul | RAHUL | Sharma | SHARMA | Laboratory Director | PHYSICAL MEDICINE AND REHABILITATION |
| 2 | Kashif | KASHIF | Khan | KHAN | Anesthesia | GERIATRIC MEDICINE |
| 3 | Mark | MARK | Smith | SMITH | Anesthesia | INTERNAL MEDICINE |
| 4 | Paul | PAUL | Harris | HARRIS | Apprenticeship in Joinery | FAMILY PRACTICE |
import pandas as pd
df6 = pd.read_csv('../../../DSAIML/hcpuniverse.csv',sep=";") #goback to the previous/parent directory files
df6.head()
| c_First_Name | h_First_Name | c_Last_Name | h_Last_Name | c_Title | h_Title | |
|---|---|---|---|---|---|---|
| 0 | Brian | BRIAN | Kelly | KELLY | Medicine | PHYSICAL MEDICINE AND REHABILITATION |
| 1 | Rahul | RAHUL | Sharma | SHARMA | Laboratory Director | PHYSICAL MEDICINE AND REHABILITATION |
| 2 | Kashif | KASHIF | Khan | KHAN | Anesthesia | GERIATRIC MEDICINE |
| 3 | Mark | MARK | Smith | SMITH | Anesthesia | INTERNAL MEDICINE |
| 4 | Paul | PAUL | Harris | HARRIS | Apprenticeship in Joinery | FAMILY PRACTICE |
| c_First_Name | h_First_Name | c_Last_Name | h_Last_Name | c_Title | h_Title | |
|---|---|---|---|---|---|---|
| 0 | Brian | BRIAN | Kelly | KELLY | Medicine | PHYSICAL MEDICINE AND REHABILITATION |
| 1 | Rahul | RAHUL | Sharma | SHARMA | Laboratory Director | PHYSICAL MEDICINE AND REHABILITATION |
| 2 | Kashif | KASHIF | Khan | KHAN | Anesthesia | GERIATRIC MEDICINE |
| 3 | Mark | MARK | Smith | SMITH | Anesthesia | INTERNAL MEDICINE |
| 4 | Paul | PAUL | Harris | HARRIS | Apprenticeship in Joinery | FAMILY PRACTICE |
import pandas as pd
df7 = pd.read_csv(
'~/hcpuniverse.csv', sep=";"
) #goback to the computer's account named directory(if the file located there) "C:\Users\Administrator" is nothing but ~
df7.head()
| c_First_Name | h_First_Name | c_Last_Name | h_Last_Name | c_Title | h_Title | |
|---|---|---|---|---|---|---|
| 0 | Brian | BRIAN | Kelly | KELLY | Medicine | PHYSICAL MEDICINE AND REHABILITATION |
| 1 | Rahul | RAHUL | Sharma | SHARMA | Laboratory Director | PHYSICAL MEDICINE AND REHABILITATION |
| 2 | Kashif | KASHIF | Khan | KHAN | Anesthesia | GERIATRIC MEDICINE |
| 3 | Mark | MARK | Smith | SMITH | Anesthesia | INTERNAL MEDICINE |
| 4 | Paul | PAUL | Harris | HARRIS | Apprenticeship in Joinery | FAMILY PRACTICE |
Tables Generator: https://www.tablesgenerator.com/markdown_tables
IPython.display Module:How to Display Contents of Different Types in Jupyter Notebook/Lab:
https://coderzcolumn.com/tutorials/python/how-to-display-contents-of-different-types-in-jupyter-notebook-lab
LaTeX/Mathematics:
https://en.wikibooks.org/wiki/LaTeX/Mathematics
https://towardsdatascience.com/write-markdown-latex-in-the-jupyter-notebook-10985edb91fd
https://personal.math.ubc.ca/~pwalls/math-python/jupyter/latex/
https://www.overleaf.com/learn
(\cos (2\theta) = \cos^2 \theta - \sin^2 \theta)
[\cos (2\theta) = \cos^2 \theta - \sin^2 \theta]
$\cos (2\theta) = \cos^2 \theta - \sin^2 \theta$
$\sum$
$\mathtt{afaf}$
$\mathscr{ABCD}$
$\widehat{AAA}$
$\nsupseteq$
$\Phi, \phi and \varphi$
A matrix in text must be set smaller: $\bigl(\begin{smallmatrix} a&b \ c&d \end{smallmatrix} \bigr)$ to not increase leading in a portion of text.
[
\begin{matrix}
a & b & c
d & e & f
g & h & i
\end{matrix}
]
$\Phi$
$e^{i \pi} + 1 = 0$
$\forall x$
Given : $\pi = 3.14$ , $\alpha = \frac{3\pi}{4}\, rad$
$ \delta $ $ \Delta $
$k_{n+1} = n^2 + k_n^2 - k_{n-1}$
$\frac{n!}{k!(n-k)!} = \binom{n}{k}$
$\begin{equation}
\frac{
\begin{array}[b]{r}
\left( x_1 x_2 \right)
\times \left( x’_1 x’_2 \right)
\end{array}
}{
\left( y_1y_2y_3y_4 \right)
}
\end{equation}$
$ \int\limits_a^b $
$ 50 \textrm{ apples} \times 100 \textbf{ apples} = \textit{lots of apples}^2 $
$ \begin{equation} x = a_0 + \cfrac{1}{a_1 + \cfrac{1}{a_2 + \cfrac{1}{a_3 + \cfrac{1}{a_4} } } } \end{equation} $
$ \binom{n}{k} = \frac{n!}{k!(n-k)!} $
|
|
|

Embedding Images From Local Folder:

Above Code we can Use This Below Code as per Obsidian Point of view to display in the Obsidian platform:
![[imgsAudVid/Engelbart.jpg]]
Using Python Code
from IPython.display import Image
i = Image(filename='../03-imgs/1_N1tiuQF9phkp8eYlum9twA.jpeg')
i # list of things you can pass to a dataframe

Note: To get above please go through below document to install sufficient software tools:`
nbconvert: Convert Notebooks to other formats:https://nbconvert.readthedocs.io/en/latest/index.html
Source: https://mpievolbio-scicomp.pages.gwdg.de/blog/post/2020-12-09_pandoc_vs_nbconvert/
pandoc --to pdf --from ipynb -o Notebook.pdf Notebook.ipynb
OR
Download as PDF via LaTex(.pdf)
OR
Goto Chrome three dots choose print option and Save as PDF
Use Another Approach like below:
https://jupytext.readthedocs.io/en/latest/using-cli.html
Using nbconvert with all necessary installation mentioned below:
https://nbconvert.readthedocs.io/en/latest/install.html
Sharing and Publishing Jupyter Notebooks and Exporting the Jupyter Notebook:
https://jupyter-contrib-nbextensions.readthedocs.io/en/latest/install.html
https://reproducible-science-curriculum.github.io/publication-RR-Jupyter/02-exporting_the_notebook/index.html
https://www.codegrepper.com/code-examples/shell/install+nbextensions
A collection of various notebook extensions for Jupyter:
https://github.com/ipython-contrib/jupyter_contrib_nbextensions
# Sample Code
import matplotlib.pyplot as plt
import numpy as np
xpoints = np.array([1, 8])
ypoints = np.array([3, 10])
plt.plot(xpoints, ypoints)
plt.show()


(Neither displays in ipynb or md file directly from jupyter but it displays in the Obsidian platfrom)
![[imgsAudVid/Excerpt from Mother of All Demos (1968).ogg]]
(Neither displays in ipynb or md file directly from jupyter but it displays in the Obsidian platfrom)
import IPython
IPython.display.Audio('imgsAudVid/Excerpt from Mother of All Demos (1968).ogg')
from IPython.display import Video
Video("imgsAudVid/SampleVIDEO1.mp4", embed=True)
from IPython.display import YouTubeVideo
YouTubeVideo('Gx1I_J_Y_Is', width=400, height=200)
(Neither displays in ipynb or md file directly from jupyter but it displays in the Obsidian platfrom)
print("hello world")
hello world
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
new_array = np.logspace(1., 10., num=120, endpoint=True, base=2)
new_array
array([ 2. , 2.10764261, 2.22107869, 2.34062004,
2.46659527, 2.59935064, 2.73925109, 2.88668115,
3.0420461 , 3.20577299, 3.37831188, 3.56013703,
3.75174825, 3.95367224, 4.16646404, 4.39070858,
4.62702224, 4.87605462, 5.13849024, 5.41505049,
5.70649558, 6.01362662, 6.33728785, 6.67836895,
7.03780748, 7.41659147, 7.8157621 , 8.23641662,
8.67971131, 9.1468647 , 9.6391609 , 10.15795312,
10.70466741, 11.28080658, 11.88795431, 12.52777953,
13.20204097, 13.91259205, 14.66138591, 15.45048084,
16.28204588, 17.15836684, 18.08185253, 19.05504144,
20.08060864, 21.1613732 , 22.30030592, 23.50053749,
24.76536709, 26.09827147, 27.5029145 , 28.98315726,
30.54306861, 32.18693642, 33.91927935, 35.74485923,
37.66869421, 39.69607249, 41.83256692, 44.08405027,
46.45671139, 48.95707223, 51.59200575, 54.36875483,
57.29495217, 60.37864128, 63.62829855, 67.05285662,
70.66172888, 74.46483535, 78.47262997, 82.69612933,
87.14694294, 91.83730514, 96.78010877, 101.98894053,
107.47811842, 113.26273102, 119.35867902, 125.78271891,
132.552509 , 139.68665803, 147.20477627, 155.12752945,
163.47669555, 172.27522466, 181.54730209, 191.31841483,
201.61542161, 212.46662673, 223.90185787, 235.95254808,
248.65182216, 262.03458775, 276.13763125, 290.99971896,
306.66170362, 323.16663674, 340.5598869 , 358.88926448,
378.20515309, 398.56064803, 420.01170228, 442.61728026,
466.43951995, 491.54390367, 517.99943809, 545.8788439 ,
575.25875571, 606.21993272, 638.84748069, 673.23108587,
709.46526156, 747.64960787, 787.88908554, 830.29430441,
874.9818275 , 922.07449141, 971.70174396, 1024. ])
# Silly example data
bp_x = np.linspace(0, 2*np.pi, num=40, endpoint=True)
bp_y = np.sin(bp_x)
# Make the plot
plt.plot(bp_x, bp_y, linewidth=3, linestyle="--",
color="blue", label=r"Legend label $\sin(x)$")
plt.xlabel(r"Description of $x$ coordinate (units)")
plt.ylabel(r"Description of $y$ coordinate (units)")
plt.title(r"Title here (remove for papers)")
plt.xlim(0, 2*np.pi)
plt.ylim(-1.1, 1.1)
plt.legend(loc="lower left")
plt.show()

import sys;
print(sys.executable)
C:\Users\Administrator\anaconda3\python.exe